package com.jason.bean;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity(name = "resource")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Resource {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@Column(name = "name", length = 100, nullable = false, unique = true)
	private String name;
	@Column(name = "url", length = 200)
	private String url;
	@Column(name = "pid", columnDefinition = "int default -1")
	private Integer pid;
	@Column(name = "backup1")
	private String backup1;
	@Column(name = "backup2")
	private String backup2;
	@Column(name = "backup3")
	private String backup3;
	@Column(name = "backup4")
	private String backup4;
	@Column(name = "backup5")
	private String backup5;
	@CreationTimestamp
	@Column(name = "create_time", nullable = false)
	private Timestamp createTime;
	@UpdateTimestamp
	@Column(name = "update_time")
	private Timestamp updateTime;
	@Column(name = "status", length = 2, nullable = false)
	private Integer status;
//	@ManyToMany(mappedBy = "resources",fetch=FetchType.LAZY)
//	private Set<Role> roles; 
}
